//
// Created by dgy on 2022/10/6.
//
#include "iostream"
using namespace std;
struct TreeNode{
    TreeNode() {

    }

    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x):val(x),left(NULL),right(NULL){}
};
TreeNode *mirrorTree(TreeNode *root){
    if (root== nullptr)
        return nullptr;
    if(root->left==NULL&&root->right==NULL)
        return root;
    TreeNode *temp;
    temp=root->left;
    root->left=mirrorTree(root->right);
    root->right=mirrorTree(temp);
    return root;
}